package aaaaa;

import java.util.concurrent.DelayQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

public class Test {
    public static void main(String[] args) throws InterruptedException {


        ReentrantLock lock = new ReentrantLock();


        lock.lock();

        lock.unlock();

        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("HEIHEIHEI");
            }
        });


        ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock();

        reentrantReadWriteLock.getReadLockCount();

        ExecutorService threadPoolExecutor = Executors.newFixedThreadPool(3);
        threadPoolExecutor.execute(thread);


        threadPoolExecutor.shutdown();

        threadPoolExecutor.shutdownNow();
//
//        String sf = "2";
//        String biz = "203";
//        System.out.println(sf.hashCode());
//        System.out.println(biz.hashCode());
//
//        long aa = sf.hashCode() + biz.hashCode();
//        System.out.println(aa);
//        System.out.println(aa % 200);
//
//
//        System.out.println("=========");
//
//        DelayQueue<MyDelayOrder> delayQueue = new DelayQueue();
//        MyDelayOrder myDelayOrder = new MyDelayOrder("第一", 4000L + System.currentTimeMillis());
//        MyDelayOrder myDelayOrder1 = new MyDelayOrder("第二", 1000L + System.currentTimeMillis());
//
//        delayQueue.offer(myDelayOrder);
//        delayQueue.offer(myDelayOrder1);
//
//        ReentrantLock lock = new ReentrantLock();
//        lock.lock();
//
//        while (true) {
//            MyDelayOrder result = delayQueue.take();
//            System.out.println(result.getName());
//        }

    }

    public int div(int dividend, int divisor) {

        int result = div1(dividend, divisor);
        return result;
    }

    public int div1(int dividend, int divisor) {
        if (dividend < divisor) {
            return 0;
        }
        int count = 1;
        int max = divisor;
        if (divisor + max < dividend) {
            count = count + count;
            max = max + max;
        }
        return count + div1(dividend - max, divisor);
    }
}
